package niuKe.HW;

public class HJ13 {
    public static void main(String[] args) {
        String in = "I am a boy";
        String[] strs = in.split(" ");
        if (strs.length == 1) {
            System.out.println(in);
        }
        for (int i = 0; i < strs.length / 2; i++) {
            swap(strs, i, strs.length - i - 1);
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < strs.length - 1; i++) {
            sb.append(strs[i]).append(" ");
        }
        sb.append(strs[strs.length - 1]);
        System.out.println(sb.toString());
    }

    private static void swap(String[] strs, int i, int j) {
        String temp = strs[i];
        strs[i] = strs[j];
        strs[j] = temp;
    }
}
